/**
* Form Management Helper
* @author: trungdt , ABSoft Viet Nam
* @version: 1.0
* @since: Apr 2012
* Change log
* Apr 19, 2012 - trungdt - Add preinit
*/

var __formhelper_src='';
var __formhelper_id ="formhelper";
function __FormHelper_SetDefaultLocation(location_src){
	__formhelper_src = location_src;
}

function __FormHelper_Init(selector_name,callback,preinit){
	__formhelper_id = selector_name;
	
	// call preinit before load
	if (preinit!= "" && (eval("typeof "+preinit+"== 'function'") == true))
	{
		eval(preinit+"();");
	}
	
	if (_fh_grid_type == 0) // datagrid
		jQuery("#"+selector_name).datagrid(_fh_options);
	else
		jQuery("#"+selector_name).treegrid(_fh_options);
	if (callback!= "" && (eval("typeof "+callback+"== 'function'") == true))
	{
		eval(callback+"();");
	}
}

/**
* Return grid object
*/
function __FormHelper_GetGridObject(){
	if (_fh_grid_type == 0) // datagrid
		return jQuery("#"+__formhelper_id);
	else
		return jQuery("#"+__formhelper_id);
}

/**
* return Action link
*/
function __FormHelper_GetActionLink(){
	return _link_url;
}

function __FormHelper_GetSrc(){
	return __formhelper_src;
}

function __FormHelper_GetContextMenu(){
	return jQuery("#"+_fh_context_id);
}

function __FormHelper_GetToolbar(){
	return jQuery("#"+_fh_toolbar_id);
}
